package com.sj.entity;

import com.baomidou.mybatisplus.annotation.IdType;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableField;

import java.io.Serializable;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;

/**
 * <p>
 *
 * </p>
 *
 * @author 小七
 * @since 2021-07-30
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Comment对象", description = "")
public class Comment implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "评论id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "评论内容")
    @NotBlank(message = "评论内容不能为空")
    private String content;

    @ApiModelProperty(value = "评论用户id")
    private Integer userId;

    @TableField(exist = false)
    private User user;

    @ApiModelProperty(value = "评论博客id")
    private Integer blogId;

    @TableField(exist = false)
    private Blog blog;

    @ApiModelProperty(value = "回复的评论id")
    private Integer parentCommentId;

    /**
     * 该评论回复的评论
     */
    @TableField(exist = false)
    private Comment parentComment;

    /**
     * 回复该评论的所有评论
     */
    @TableField(exist = false)
    private List<Comment> childCommentList;

    @ApiModelProperty(value = "评论审核状态 1通过 2不通过")
    private Integer checked;

    @ApiModelProperty(value = "评论是否删除 1启用 2删除")
    @TableLogic(value = "1", delval = "0")
    private Integer status;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;


}
